<template>
	<div id="app">
		<div id="header">
			<a class="return" @click="itemClicked1(comment)"><i class="am-icon-angle-left"></i></a>
			<span>评论列表</span>
		</div>
		<div id="note_comment_list">
			<div class="tag">
				<a class="cur">最新评论</a>
			</div>
			
				<ul>
					<li v-for="a in comment1">
						
							<div class="pic"><img :src="'https://yo.docshare.org.cn'+a.user_photo"></div>
							<div class="con">
								<label>{{a.user_name}}</label>
								<p>{{a.comment}}</p>
								<span>发表于：{{a.commentdate}}</span>
								<div class="clear"></div>
							</div>
							
					</li>
				</ul>
				<div class="button_mo">
					<a @click="itemClicked(comment)">写评论</a>
				</div>
			
		</div> 
	</div>
</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				comment1: {},
				fd: {
					comment: "",
					vid:'',
				}
			}
		},
		methods: {
			submit: function() {
				var that = this;
				uni.request({
					url: `${config.baseUrl}/article/write?token=${uni.getStorageSync('token')}`,
					method: 'POST',
					data: this.fd,
					success(r) {
						if (r.data.succ) {
							uni.navigateTo({
								url: `note_comment_list?id=${that.fd.vid}`
							})
						} else {}
					},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
				})
			},
			itemClicked1: function(item) {
				uni.navigateTo({
					url: `note_comment_list?id=${this.fd.vid}`
				})
			}
		},
		onLoad(option) {
			var that = this;
			if (option.id) {
				this.$set(this.fd, 'vid', option.id);
				// this.fd.vid = option.id;
			}
			uni.request({
				url: `${config.baseUrl}/article/one?id=${that.fd.vid}&token=${uni.getStorageSync('token')}`,
				method: "GET",
				success(r) {
					if (r.data.succ) {
						that.comment1 = r.data.data;
					} else {
	
					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			})
		}
	}
</script>

<style>
</style>
